import {request, handleFetchResultNotification, REQUEST_TYPE} from '../utils';
import stringify from 'Shared/utils/stringify';
import {formatMessage} from './intl';
const baseUrl = '/parts/api/v1';


const getListDesc = formatMessage({
    id: 'api.message.getListDesc',
    defaultMessage: '查询BO报表'
});
// 查询BO满足率列表
export const getListRate = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/backOrders/rate?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};
// 查询BO分类及满足率汇总统计列表
export const getListType = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/backOrders/type?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};
// 查询订单列表
export const getListMonth = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/backOrders/month?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};
// 查询月份所有周列表
export const getWeekList = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/backOrders/week?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};
// 查询12个总代数据需要有后台配置表
export const getInit = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/ui/backOrder/init?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};
// 查询选择中的总代国家列表统计
export const getListCountry = pageOption => {
    const queryString = stringify(pageOption);
    return request(`${baseUrl}/backOrders/country?${queryString}`, null, null)
        .then(handleFetchResultNotification(REQUEST_TYPE.query, getListDesc));
};

